package task01;

import java.util.Scanner;

public class UserLogin {
    public static void main(String[] args) {
        User user = new User("admin", "admin");
        for (int x = 0; x <=3; x++) {
            System.out.println("请输入用户名：");
            Scanner sc = new Scanner(System.in);
            String name = sc.nextLine();
            System.out.println("请输入密码：");
            String password = sc.nextLine();
            if (name.equals(user.getName()) && password.equals(user.getPassword())) {
                System.out.println("登录成功");
                GuessNumber.start();
                break;
            } else {
                if (x < 3) {
                    System.out.println("登录失败，你还有" + (2 - x) + "次机会");
                } else {
                    System.out.println("帐号被锁定，请与客服联系");
                }
            }
        }

    }
}

